package com.fxb.doraemon.human.config;

import io.swagger.annotations.ApiOperation;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

/**
 * @author wangxiyu@cyou-inc.com
 * @since 2019-05-08
 */
@Configuration
public class SwaggerConfiguration {

    @Bean
    public Docket swaggerSpringMvcPlugin() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.fxb.doraemon.human.rest"))
                .paths(PathSelectors.any())
                .build();
    }

    /**
     * API的解释说明
     *
     * @return apiInfo
     */
    private ApiInfo apiInfo() {
        return new ApiInfoBuilder().title("组织管理服务")
                .contact(new Contact("方小白", "", "fangjiaxiaobai@gmail.com"))
                .version("0.0.1")
                .description("用于用户,组织架构,岗位信息的管理")
                .build();

    }


}
